import 'package:flutter/material.dart';
import 'package:flutter_09_game/base/controller/base_controller.dart';
import 'package:flutter_09_game/generated/locales.g.dart';
import 'package:flutter_09_game/http/http_export.dart';
import 'package:flutter_09_game/pages/home/home_gameplay_tutorial/home_gameplay_tutorial_list/model_game_active.dart';
import 'package:flutter_09_game/pages/profile/profile_bet_record/profile_bet_record_battle/profile_bet_record_battle_view.dart';
import 'package:flutter_09_game/pages/profile/profile_bet_record/profile_bet_record_game/profile_bet_record_game_logic.dart';
import 'package:flutter_09_game/pages/profile/profile_bet_record/profile_bet_record_game/profile_bet_record_game_view.dart';
import 'package:flutter_09_game/pages/profile/profile_bet_record/profile_bet_record_hash/profile_bet_record_hash_view.dart';
import 'package:flutter_09_game/pages/profile/profile_bet_record/profile_bet_record_list/profile_bet_record_list_logic.dart';
import 'package:flutter_09_game/pages/profile/profile_bet_record/profile_bet_record_list/profile_bet_record_list_view.dart';
import 'package:flutter_09_game/pages/profile/profile_bet_record/utils_bet_record.dart';
import 'package:flutter_09_game/widgets/tab/common_tab_bar_page.dart';
import 'package:get/get.dart';

class ProfileBetRecordLogic extends BaseController
    with GetSingleTickerProviderStateMixin {
  late TabController tabController;

  List<CommonTabModel> tabData = [];

  // RxList<ModelGameActive> gameActiveList = RxList();

  @override
  void onInit() {
    super.onInit();
    tabData = [
      CommonTabModel(
        view: ProfileBetRecordHashPage(),
        title: LocaleKeys.hashRecord.tr,
      ),
      CommonTabModel(
        view: ProfileBetRecordGamePage(),
        title: LocaleKeys.slotsRecord.tr,
      ),
      // ProfileBetRecordHashPage
      CommonTabModel(
        view: ProfileBetRecordBattlePage(),
        title: LocaleKeys.battleRoyaleRecord.tr,
      ),


    ];
    tabController = TabController(length: tabData.length, vsync: this);
    // getGameActive();
  }

  @override
  void onClose() {
    tabController.dispose();
    // TODO: implement onClose
    super.onClose();
  }

  // getGameActive() async {
  //   HttpResponse response = await HttpManager().get(
  //     API.getGameActive,
  //     fromJson: ModelGameActive.fromJson,
  //   );
  //   if (response.isSuccess) {
  //     gameActiveList.value = response.data;
  //     UtilsBetRecord.gameRows.clear();
  //     UtilsBetRecord.gameRows.add(LocaleKeys.allGames.tr);
  //     for (var item in gameActiveList) {
  //       UtilsBetRecord.gameRows.add(item.game?.name ?? '');
  //     }
  //
  //     if (Get.isRegistered<ProfileBetRecordListLogic>(tag: '2')) {
  //       Get.find<ProfileBetRecordListLogic>(tag: '2').update();
  //     }
  //     if (Get.isRegistered<ProfileBetRecordListLogic>(tag: '1')) {
  //       Get.find<ProfileBetRecordListLogic>().update();
  //     }
  //   }
  // }
}
